package com.noahplat.device.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;
import tk.mybatis.mapper.annotation.KeySql;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * @ClassName: Device
 * @Description: 设备实体类
 * @Author 李景星
 * @Date 2021/3/3
 * @Version 1.0
 */
@Data
@Table(name = "tb_device")
public class Device implements Serializable {

    @Id
    @KeySql(useGeneratedKeys = true)
    private Long id;    //主键

    @NotEmpty(message = "设备唯一标识不能为空")
    @Length(max = 20, message = "设备唯一标识长度不符合要求")
    private String imei;    //设备唯一标识

    @NotEmpty(message = "经销商ID不能为空")
    private Long dealer;    //经销商ID，登记账套id

    @NotEmpty(message = "设备供应商不能为空")
    @Length(max = 50, message = "设备供应商长度不符合要求")
    private String prod;    //设备供应商

    @NotNull(message = "设备型号ID不能为空")
    private Long modelid;   //设备型号ID

    @NotNull(message = "设备类型ID不能为空")
    private Long typeid;    //设备类型ID

    @NotEmpty(message = "设备激活码不能为空")
    @Length(max = 6, message = "设备激活码长度不符合要求")
    private String devcode;     //设备激活码

    @Column(name = "sup_location")
    @NotEmpty(message = "定位标识不能为空")
    @Length(max = 1, message = "定位标识长度不符合要求")
    private String supLocation;//是否支持定位 Y支持  N不支持

    @Column(name = "sup_temp")
    @NotEmpty(message = "体温标识不能为空")
    @Length(max = 1, message = "体温标识长度不符合要求")
    private String supTemp;//是否支持体温监测 Y支持  N不支持

    @Column(name = "sup_heart")
    @NotEmpty(message = "心率标识不能为空")
    @Length(max = 1, message = "心率标识长度不符合要求")
    private String supHeart;//是否支持心率测量 Y支持  N不支持

    @Column(name = "sup_blood")
    @NotEmpty(message = "血压标识不能为空")
    @Length(max = 1, message = "血压标识长度不符合要求")
    private String supBlood;//是否支持血压监测 Y支持  N不支持

    @Column(name = "sup_sleep")
    @NotEmpty(message = "睡眠标识不能为空")
    @Length(max = 1, message = "睡眠标识长度不符合要求")
    private String supSleep;//是否支持睡眠监测 Y支持  N不支持

    @Column(name = "sup_step")
    @NotEmpty(message = "计步标识不能为空")
    @Length(max = 1, message = "计步标识长度不符合要求")
    private String supStep;//是否支持计步 Y支持  N不支持

    @Column(name = "sup_oxygen")
    @NotEmpty(message = "血氧标识不能为空")
    @Length(max = 1, message = "血氧标识长度不符合要求")
    private String supOxygen;//是否支持睡眠监测 Y支持  N不支持

    @Column(name = "create_time")
    @NotEmpty(message = "创建时间不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;   //创建时间

    @Transient
    private String model;   //设备型号

    @Transient
    private String image;   //设备型号示例图片

    @Transient
    private String type;    //设备类型

    @Transient
    private String temp;    //体温

    @Transient
    private String heart; //心率

    @Transient
    private String blood; //血压

    @Transient
    private String step;  //步数

    @Transient
    private String sp;  //电量  0:10% 1:30% 2：60%  3:100%

    @Transient
    private String site;  //坐标

    @Transient
    private Date siteTime;   //坐标时间



}
